package com.qk.management.mapper;

import com.qk.domain.user.UserDO;
import com.qk.dto.user.UserDTO;
import com.qk.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface UserMapper {

    void insert(User user);

    List<UserDO> selectByPage(UserDTO dto);

    Integer countByRoleId(Integer roleId);

    @Delete("DELETE FROM user WHERE id = #{id}")
    void deleteById(Long id);

    void update(User user);

    @Select("SELECT * FROM user WHERE id = #{id}")
    User selectById(Integer id);

    @Select("SELECT * FROM user")
    List<User> selectAllUsers();

    List<User> getUsersByRole(String roleLabel);

    @Select("SELECT * FROM user WHERE dept_id = #{deptId}")
    List<User> getUsersByDept(Integer deptId);
}

